from django.conf.urls import url
from . import views
from rest_framework.routers import DefaultRouter
# 導入登陸用戶的方法
from rest_framework_jwt.views import obtain_jwt_token

urlpatterns = [
    url(r'^usernames/(?P<username>\w{5,20})/count/$',views.CheckUsernameViews.as_view()),
    url(r'^phones/(?P<mobile>1[345789]\d{9})/count/$',views.CheckMobileViews.as_view()),
    url(r'^$',views.RegisterUserViews.as_view()),
    url(r'^auths/$', views.UserObtainJSONWebToken.as_view()),  # 登陸用戶的路徑
    url(r'^infos/$', views.UserInfoView.as_view()),
    url(r'^emails/$', views.EmailSendView.as_view()),
    url(r'^emails/verification/$', views.VerificationEmailView.as_view()),
    url(r'^browerhistories/$',views.UserBrowerHistoryView.as_view())
]

# 創建DefaultRouter對象
router =DefaultRouter()

# 注冊視圖集
router.register(r'addresses',views.AddressView,base_name="addresses")

# 添加到urlpatterns
urlpatterns += router.urls
